(function () {
        let time_tmp = Date.now();
        let date = Date.parse(new Date());
        window = {};
        let click = null;
        let key_tmp;
        let iv_tmp;
        if (!click) {
                key_tmp = date * 1234;
            console.log(11)
        } else {
            key_tmp = date * 1244;
        }
        if (time_tmp - window.time < 1000) {
            iv_tmp = date * 4321;
            console.log(1)
        } else {
            iv_tmp = date * 4311;
        }
        console.log(key_tmp)
        console.log(iv_tmp)
        console.log(date)
        const key = CryptoJS.enc.Utf8.parse(key_tmp);
        var iv = CryptoJS.enc.Utf8.parse(iv_tmp);
        (function tmp(date, key, iv) {
                function Encrypt(word) {
                    let srcs = CryptoJS.enc.Utf8.parse(word);
                    let encrypted = CryptoJS.AES.encrypt(srcs, key, {
                        iv: iv,
                        mode: CryptoJS.mode.CBC,
                        padding: CryptoJS.pad.Pkcs7
                    });
                    return encrypted.ciphertext.toString().toUpperCase();
                }

                window.sign = Encrypt(date);
            }
        )(date, key, iv);
    }
)();

(function() {
    'use strict';
    var cookie_cache = document.cookie;
    Object.defineProperty(document, 'cookie', {
        get: function() {
            console.log(cookie_cache);
            return cookie_cache;
        },
        set: function(val) {
            debugger;
            var cookie = val.split(";")[0];
            var ncookie = cookie.split("=");
            var flag = false;
            var cache = cookie_cache.split(";");
            cache = cache.map(function(a){
                if (a.split("=")[0] === ncookie[0]){
                    flag = true;
                    return cookie;
                }
                return a;
            })
            cookie_cache = cache.join(";");
            if (!flag){
                cookie_cache += cookie + ";";
            }
        },
    });
})();


(function() {
    'use strict';
    var sign = document.cookie;
    Object.defineProperty(document, 'cookie', {
        get: function() {
            console.log(sign);
            return sign;
        },
        set: function(val) {
            debugger;
            console.log(val)
        },
    });
})();
